
public class Board {

	private String title;
	private int width;
	private int height;
	private Player[] player;
	private Dice[] dice;
	private Main game;
	
	public Board(Main game) {
		
		this.game = game;
		this.title = "Hello World";
		this.width = 3;
		this.height = 4;
		this.player = new Player[0];
		this.dice = new Dice[0];
	}

	public boolean getActivePlayer(int index){
		return game.gameState.getActivePlayer(index);
	}
	
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}

	public int getWidth() {
		return width;
	}

	public boolean setWidth(int width) {
	  if(width <= 0) {
	    System.out.println("Error: invalid board width " + width);
	    return false;
	  }
		this.width = width;
		return true;
	}

	public int getHeight() {
		return height;
	}

	public boolean setHeight(int height) {
	  if(height <= 0) {
	    System.out.println("Error: invalid board height " + height);
	    return false;
	  }
		this.height = height;
		return true;
	}

	public Player[] getPlayer() {
		return player;
	}

	public void setPlayer(Player[] player) {
		Player[] pList = player;

		for(int i=0; i<pList.length; i++)
		{
		  pList[i] = new Player(this);
		}
		
		this.player = pList;
	}

  // flexibly set Player properties
	
	public void setPlayerProperties(int index, int points)
	{	
		player[index].setPlayer(points);
	}
	
	public void setPlayerProperties(int index, int points, String name)
	{	
		player[index].setPlayer(points, name);
	}
	
	public void setPlayerProperties(int index, int points, String name, boolean direction)
	{	
		player[index].setPlayer(points, name, direction);
	}
	
	public void setPlayerProperties(int index, int points, String name, boolean direction, int locationX, int locationY)
	{	
		player[index].setPlayer(points, name, direction, locationX, locationY);
	}
	
	public void setPlayerProperties(int index, int points, String name, boolean direction, int locationX, int locationY, int delay)
	{	
		player[index].setPlayer(points, name, direction, locationX, locationY, delay);
	}
	
	public Dice[] getDice() {
		return dice;
	}

	public void setDice(Dice[] dice) {
		Dice[] dList = dice;

		for(int i=0; i<dList.length; i++)
		{
		  dList[i] = new Dice();
		}
		
		this.dice = dList;
	}
	
	public void setDiceSides(int index, int sides){
		dice[index].setSides(sides);
	}
	
	
}
